import request from '@/utils/request'
// SalesOrder 销售订单
// 获取销售订单列表
export function listSalesOrder(query) {
  return request({
    url: '/ord/ordorder/list',
    method: 'get',
    params: query
  })
}
// 获取同步a8错误msg
export function getToA8Fail(query) {
  return request({
    url: '/ord/ordorder/getToA8Fail',
    method: 'get',
    params: query
  })
}
// 获取销售订单开票列表
export function listBilling(query) {
  return request({
    url: '/ord/ordorder/billing/list',
    method: 'get',
    params: query
  })
}
// 获取销售订单下拉列表
export function listSalesOrderSelect(query) {
  return request({
    url: '/ord/ordorder/getPull',
    method: 'get',
    params: query
  })
}
// 保存销售订单
export function setSalesOrder(data) {
  return request({
    url: '/ord/ordorder/save',
    method: 'post',
    data
  })
}
// 保存销售订单合同
export function orderUploadContract(data) {
  return request({
    url: '/ord/ordorder/upload/contract',
    method: 'post',
    data
  })
}
// 关闭销售订单
export function stopSalesOrder(data) {
  return request({
    url: '/ord/ordorder/stop',
    method: 'post',
    data
  })
}
//删除销售订单
export function delSalesOrder(ids) {
  return request({
    url: '/ord/ordorder/delete/' + ids,
    method: 'post'
  })
}
//通过id再来一单
export function salesOrderCopy(id) {
  return request({
    url: '/ord/ordorder/copyOne/' + id,
    method: 'get'
  })
}
//通过id获取销售订单详情
export function getSalesOrderDetail(id) {
  return request({
    url: '/ord/ordorder/detail/' + id,
    method: 'get'
  })
}
//通过id获取销售订单表单
export function getSalesOrder(id) {
  return request({
    url: '/ord/ordorder/get/' + id,
    method: 'get'
  })
}
//通过id获取合并开票数据
export function mergerOrder(data) {
  return request({
    url: '/ord/ordorder/mergerOrder',
    method: 'post',
    data
  })
}
//通过id获取产品统计
export function getProductCount(id) {
  return request({
    url: '/ord/ordorder/getProductCount/' + id,
    method: 'get'
  })
}
// 保存产品服务时间接口
export function updateServiceDate(data) {
  return request({
    url: '/ord/order/product/updateServiceDate',
    method: 'post',
    data
  })
}
//获取产品分页
export function getProductList(query) {
  return request({
    url: '/ord/ordorder/getProduct/',
    method: 'get',
    params: query
  })
}
//获取培训产业列表数据
export function getIndustryList(query) {
  return request({
    url: 'ord/ordorder/train',
    method: 'get',
    params: query
  })
}
// 订单导出---新增导出列表
export function exportOrder(data) {
  return request({
    method: 'post',
    url: '/ord/ordorder/list/excel',
    data
  })
}
//通过id同步到A8
export function synchronousA8(id) {
  return request({
    url: '/ord/ordorder/synchronous/' + id,
    method: 'get'
  })
}
//通过id同步到CRM
export function synchronousCRM(id) {
  return request({
    url: '/ord/ordorder/getOrderToCrm/' + id,
    method: 'get'
  })
}
//通过id同步到诺诺
export function synchronousNuonuo(id) {
  return request({
    url: '/ord/order/ordordersync/getOrderToNuoNuo/' + id,
    method: 'get'
  })
}
//通过id同步到诺企服
export function synchronousAisino(id) {
  return request({
    url: '/ord/order/ordordersync/getOrderToAisino/' + id,
    method: 'get'
  })
}
//通过id冲红订单
export function reversalSalesOrder(id) {
  return request({
    url: '/ord/ordorder/reversal/' + id,
    method: 'get'
  })
}

//通过订单冲红
export function orderFlushRed(data) {
  return request({
    url: '/ord/ordorder/flush/red',
    method: 'post',
    data
  })
}
//蓝字开票
export function blueMakeOutInvoice(ids) {
  return request({
    url: '/ord/ordorder/makeOutInvoice/' + ids,
    method: 'post'
  })
}
//蓝字开票
export function makeOutInvoice(data) {
  return request({
    url: '/ord/ordorder/blue/makeOutInvoice',
    method: 'post',
    data
  })
}
// 红字开票
export function redMakeOutInvoice(data) {
  return request({
    url: '/ord/ordorder/red/makeOutInvoice/',
    method: 'post',
    data
  })
}
// 数据导入
export function importData(data) {
  return request({
    url: '/ord/ordorder/upload/train',
    method: 'post',
    data
  })
}
// 订单数据导入
export function importOrderData(data) {
  return request({
    url: '/ord/ordorder/import',
    method: 'post',
    data
  })
}

// 签购单信息查询
export function getSalesSlip(data) {
  return request({
    url: '/ord/ordorder/signedPurchase',
    method: 'post',
    data
  })
}
// 签购单打印次数
export function addSalesSlipNum(data) {
  return request({
    url: '/ord/ordorder/addPrintNum',
    method: 'post',
    data
  })
}

//销售订单审批是否直接完结
export function orderGoFinish(data) {
  return request({
    url: '/ord/ordorder/goFinish',
    method: 'post',
    params: data
  })
}

//通过id同步销售订单出库单
export function handleOutbound(id) {
  return request({
    url: '/ord/ordorder/handle/sync/outbound/' + id,
    method: 'get'
  })
}

// 获取销售订单列表自动审核配置
export function listConfApprove(query) {
  return request({
    url: '/ord/conf/approve/list',
    method: 'get',
    params: query
  })
}
// 保存销售订单自动审核配置
export function setConfApprove(data) {
  return request({
    url: '/ord/conf/approve/save',
    method: 'post',
    data
  })
}
// 销售订单详情关联项目
export function relatedProject(data) {
  return request({
    url: '/ord/ordorder/related/project',
    method: 'post',
    data
  })
}
//删除销售订单自动审核配置
export function delConfApprove(ids) {
  return request({
    url: '/ord/conf/approve/delete/' + ids,
    method: 'post'
  })
}

// PurchaseOrder 采购订单
// 获取采购订单列表
export function listPurchaseOrder(query) {
  return request({
    url: '/ord/ordpurchaseorder/list',
    method: 'get',
    params: query
  })
}

// 保存采购订单
export function setPurchaseOrder(data) {
  return request({
    url: '/ord/ordpurchaseorder/save',
    method: 'post',
    data
  })
}

// 关闭采购订单
export function stopPurchaseOrder(data) {
  return request({
    url: '/ord/ordpurchaseorder/stop',
    method: 'post',
    data
  })
}

//删除采购订单
export function delPurchaseOrder(ids) {
  return request({
    url: '/ord/ordpurchaseorder/delete' + ids,
    method: 'post'
  })
}

//通过id获取采购订单详情
export function getPurchaseOrderDetail(id) {
  return request({
    url: '/ord/ordpurchaseorder/detail/' + id,
    method: 'get'
  })
}

//通过id获取采购订单表单
export function getPurchaseOrder(id) {
  return request({
    url: '/ord/ordpurchaseorder/get/' + id,
    method: 'get'
  })
}
//通过id获取产品统计
export function getPurProductCount(id) {
  return request({
    url: '/ord/ordpurchaseorder/getProductCount/' + id,
    method: 'get'
  })
}
//获取产品分页
export function getPurProductList(query) {
  return request({
    url: '/ord/ordpurchaseorder/getProduct/',
    method: 'get',
    params: query
  })
}

// A8的采购订单
export function listPurchaseOrderA8(query) {
  return request({
    url: '/ord/order/purchase/list',
    method: 'get',
    params: query
  })
}
//A8的通过id获取采购订单详情
export function getPurchaseOrderDetailA8(id) {
  return request({
    url: '/ord/order/purchase/get/' + id,
    method: 'get'
  })
}
// A8的内部订单
export function listInnerOrderA8(query) {
  return request({
    url: '/ord/order/inner/list',
    method: 'get',
    params: query
  })
}
//A8的通过id获取内部订单详情
export function getInnerOrderDetailA8(id) {
  return request({
    url: '/ord/order/inner/get/' + id,
    method: 'get'
  })
}
// A8的采购、内部入库列表
export function listOrderInbound(query) {
  return request({
    url: '/ord/order/purchase/inbound/list',
    method: 'get',
    params: query
  })
}
//A8的通过id获取采购、内部入库详情
export function getOrderInbound(id) {
  return request({
    url: '/ord/order/purchase/inbound/get/' + id,
    method: 'get'
  })
}
// A8的内部出库列表
export function listInnerOrderOutbound(query) {
  return request({
    url: '/ord/order/sale/outbound/list',
    method: 'get',
    params: query
  })
}
//A8的通过id获取内部出库详情
export function getInnerOrderOutbound(id) {
  return request({
    url: '/ord/order/sale/outbound/get/' + id,
    method: 'get'
  })
}
//重新出库
export function reOutbound(ids) {
  return request({
    url: '/ord/order/sale/outbound/outbound/' + ids,
    method: 'post'
  })
}
//重新入库
export function reInbound(ids) {
  return request({
    url: '/ord/order/purchase/inbound/inbound/' + ids,
    method: 'post'
  })
}

// Innerders 内部订单
// 获取内部订单列表
export function listInnerOrder(query) {
  return request({
    url: '/ord/ordinnerorder/list',
    method: 'get',
    params: query
  })
}

// 保存内部订单
export function setInnerOrder(data) {
  return request({
    url: '/ord/ordinnerorder/save',
    method: 'post',
    data
  })
}

// 关闭内部订单
export function stopInnerOrder(data) {
  return request({
    url: '/ord/ordinnerorder/stop',
    method: 'post',
    data
  })
}

//删除内部订单
export function delInnerOrder(ids) {
  return request({
    url: '/ord/ordinnerorder/delete' + ids,
    method: 'post'
  })
}

//通过id获取内部订单详情
export function getInnerOrderDetail(id) {
  return request({
    url: '/ord/ordinnerorder/detail/' + id,
    method: 'get'
  })
}

//通过id获取内部订单表单
export function getInnerOrder(id) {
  return request({
    url: '/ord/ordinnerorder/get/' + id,
    method: 'get'
  })
}

// 入库登记
export function inbound(data) {
  return request({
    url: 'ord/ordpurchaseorder/inbound',
    method: 'post',
    data
  })
}

//通过订单id获取出库单信息
export function listOutbound(id) {
  return request({
    url: '/ord/ordorder/get/outbound/receipt/' + id,
    method: 'get'
  })
}
// 保存产品服务时间接口
export function updateOutbound(data) {
  return request({
    url: '/ord/ordorder/make/outbound/receipt',
    method: 'post',
    data
  })
}
